#ifndef	__image_h__
#define	__image_h__

#include "inccommon.h"

namespace rtMath
{
	class vec4;
};

class Image
{
public:
	enum
	{
		ChannelTypeUchar = 0,
		ChannelTypeFloat,

		NumChannelTypes
	};

public:
	static Image*	CreateFromMemory(void* data, uint32 width, uint32 height, uint32 bitsPerPixel);
	static Image*	CreateFromFile(const rtString& fileName);
	static bool		WriteToFile(const rtString& fileName, Image* image);

protected:
	Image(void* data = NULL, uint32 width = 0, uint32 height = 0, uint32 bitsPerPixel = 0, int channelType = ChannelTypeUchar);
	Image(const Image& copy);

public:
	virtual ~Image();

	uint32					GetWidth(void) const;
	uint32					GetHeight(void) const;
	uint32					GetBitsPerPixel(void) const;
	int						GetChannelType(void) const;
	void*					GetDataPtr(void);
	const void*				GetDataPtr(void) const;

	void					SetPixel(uint32 x, uint32 y, const rtMath::vec4& color);
	const rtMath::vec4		GetPixel(uint32 x, uint32 y) const;

protected:
	void*		m_Data;
	uint32		m_Width;
	uint32		m_Height;
	uint32		m_BitsPerPixel;
	int			m_ChannelType;
};

#endif	// __image_h__
